$(document).ready(function () {
    // 获取支付宝授权码
    $(document).on('click','.open-ewCode',function () {
        var aliCallBackUrl = $('#aliCallBackUrl').val();
        $('#qrcode').empty();
        new QRCode("qrcode", {
            text: aliCallBackUrl,
            width: 160,
            height: 140,
            colorDark : "#000000",
            colorLight : "#ffffff",
            correctLevel: 3
        });
        $.popup('.popup-ewCode');
    });

    // 微信配置保存
    $('.WeChat_form .temporary_storage').on('click',function () {
        var formData = $('.WeChat_form').serializeArray();

        var wxFinalRate = $('.WeChat_form input[name=wxFinalRate]').val();
        var wxSubMchId = $('.WeChat_form input[name=wxSubMchId]').val();

        if(!wxFinalRate){
            $.toast("结算费率不能为空");
        }else if(!wxSubMchId){
            $.toast("商户号不能为空");
        }else{
            $.post('/enterprise_info/edit',formData,function (result) {
                if(result.code==1){
                    $.toast("提交成功");
                }else{
                    $.toast(result.message);
                }
            });
        }

    });


});